upgrade: cursor package upgrade for Solid 2.0#869
Conversation
🦋 Changeset detectedLatest commit: b3b4f6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cursor/README.md`:
- Line 11: Update the top-line description in the README to mention both
reactive and imperative usage instead of saying "reactive-only": change the
sentence that currently reads "Primitives for setting the CSS cursor property
reactively." to a short phrase that covers both patterns (e.g., "Utilities for
setting the CSS cursor property via reactive primitives and imperative APIs").
Reference the package's reactive primitives and the new imperative functions
makeBodyCursor and makeElementCursor in the sentence so readers know both usage
modes are supported.
In `@packages/cursor/src/index.ts`:
- Around line 190-204: When the observed target goes falsy the effect currently
returns early and removes listeners without resetting dragging, which can leave
dragging true and the cursor stuck; update the createEffect callback that uses
access(target) so that when el is falsy you call setDragging(false) before
returning. Specifically, in the createEffect(() => access(target), el => { ...
}) block add a branch for !el that invokes setDragging(false) (and then returns)
so any in-progress drag is cleared when the target unmounts; keep the existing
onDown/onUp listener logic and cleanup for the case when el exists.
- Around line 80-85: The current restore writes target.style.cursor =
overwritten which loses any previous !important priority; capture the prior
priority and value via target.style.getPropertyValue("cursor") and
target.style.getPropertyPriority("cursor") when you overwrite (inside
makeElementCursor) and restore using target.style.setProperty("cursor",
previousValue, previousPriority). Apply the same change to the other cleanup
sites that currently do target.style.cursor = overwritten (the other reactive
cleanup blocks with the same pattern) so they also preserve and restore the
original property priority.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d5865c68-bbee-4ca5-80cf-ee546de8289b
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
.changeset/cursor-solid2-migration.mdpackages/cursor/README.mdpackages/cursor/package.jsonpackages/cursor/src/index.tspackages/cursor/test/index.test.ts
# Conflicts: # pnpm-lock.yaml
Solid 2.0 migration
createEffectupdated to the splitcompute/applymodel — cleanup is returned fromapplyinstead ofonCleanupisServerimport moved fromsolid-js/web→@solidjs/webflush()aftercreateRootand each signal write, since Solid 2.0 defers effects by defaultsolid-js@^2.0.0-beta.10+@solidjs/web@^2.0.0-beta.10New primitives
makeBodyCursor(cursor)/makeElementCursor(target, cursor)— imperative, non-reactive; call anywhere, get a cleanup function back.makeBodyCursordelegates tomakeElementCursor(document.body, cursor)to avoid duplicationcreateDragCursor(target, options?)— sets"grab"on the element and switches to"grabbing"on the body during drag. The body-targeting trick is necessary because element inline styles beat body inline styles even with!important, so the element cursor is cleared during drag to let the body cursor inherit throughcursorRef(cursor)— ref factory for<div ref={cursorRef("pointer")}>, accepts a static value or signalSummary by CodeRabbit
Release Notes
Breaking Changes
New Features
Documentation